cmake_minimum_required(VERSION 3.0.2)
project(align_trajectories)

## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
  roscpp
)

set(CMAKE_BUILD_TYPE "Release")
#set(CMAKE_CXX_FLAGS "-std=c++11 -O3")

#set (OpenCV_DIR "/home/cxl/Downloads/opencv-3.4.5/build")
# find_package( OpenCV REQUIRED ) # use this if in OpenCV2
FIND_PACKAGE(Pangolin REQUIRED)
FIND_PACKAGE(Sophus REQUIRED)
FIND_PACKAGE(Eigen3 REQUIRED)



include_directories(
        ${PROJECT_SOURCE_DIR}/include/
        ${Sophus_INCLUDE_DIRS}
        ${Pangolin_INCLUDE_DIRS}
        ${OpenCV_INCLUDE_DIRS}
)

#aux_source_directory(${PROJECT_SOURCE_DIR}/src/ CORE_SRCS)
#add_library(lib_${PROJECT_NAME} ${CORE_SRCS})
#add_executable(${PROJECT_NAME} ${CORE_SRCS})

add_library(lib_${PROJECT_NAME}
        src/trajectory.cpp
        src/math_utils.cpp
)

add_executable(${PROJECT_NAME} src/align_trajectories.cpp)
target_link_libraries( ${PROJECT_NAME}
        lib_${PROJECT_NAME}
        ${Sophus_LIBRARIES}
        ${Pangolin_LIBRARIES}
        ${OpenCV_LIBS}
       # /usr/local/lib/libSophus.so
)

add_custom_target(env
  COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/script/env.sh
)
